package org.michaelbel.bottomsheet.util;
/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * 颜色透明方案
 */
public class AlphaUtil {
    /**
     * 通过值获取透明度改变的颜色
     * @param value 输入0-100数值
     * @return 返回颜色
     */
    public static int valueToColor(int value) {
        if (value >= 0 && value < 20) {
            return 0x00000000;
        } else if (value >= 20 && value < 30) {
            return 0x22000000;
        } else if (value >= 30 && value < 40) {
            return 0x44000000;
        } else if (value >= 40 && value < 50) {
            return 0x66000000;
        } else if (value >= 50 && value < 60) {
            return 0x88000000;
        } else if (value >= 60 && value < 70) {
            return 0xAA000000;
        } else if (value >= 70 && value < 80) {
            return 0xBB000000;
        } else if (value >= 80 && value < 90) {
            return 0xCC000000;
        } else if (value >= 90 && value < 100) {
            return 0xDD000000;
        } else {
            return 0xFF000000;
        }
    }
}
